# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-input-elographics/xf86-input-elographics-1.1.0.ebuild,v 1.8 2006/10/13 23:15:49 joshuabaergen Exp $

# Must be before x-modular eclass is inherited
#SNAPSHOT="yes"

inherit x-modular

MY_P="wizardpen-driver-${PV}"

SRC_URI="http://www.stud.fit.vutbr.cz/~xhorak28/wizardpen-driver-${PV}.tar.gz"
DESCRIPTION="Driver for the Genius WizardPen series tablets for XOrg/XFree86 4.x."
KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sh sparc x86 ~x86-fbsd"
RDEPEND=">=x11-base/xorg-server-1.0.99"
DEPEND="${RDEPEND}
	x11-proto/inputproto
	x11-proto/randrproto
	x11-proto/xproto"

IUSE="calibrate"

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A}

	cd ${S}
	sed -i -e "/DependTarget/a USRLIBDIR=\/usr\/$(get_libdir)\/xorg" Imakefile
}

src_compile() {
	xmkmf || die "Running xmkmf failed!"
	x-modular_src_compile || die "make failed"
	
	if use calibrate ; then
	    cd ${S}/calibrate
	    emake CFLAGS="${CFLAGS}" || die "calibrate make failed"
	fi
}

src_install() {
	x-modular_src_install

        dodoc NEWS README* AUTORS COPYING ChangeLog
	dodoc ${FILESDIR}/99-wizardpen.rules

	if use calibrate ; then
	    cd ${S}/calibrate
	    exeinto /usr/bin
	    doexe wizardpen-calibrate
	    
	    docinto calibrate
	    dodoc README* COPYING ChangeLog 
	fi
}
